﻿namespace Ast
open System
 
type expr =
    | Float             of System.Double
    | Int               of int
    | String            of string
    | Id                of string
    | Add               of expr * expr
    | Sub               of expr * expr
    | Mul               of expr * expr
    | Div               of expr * expr
    | Equals            of expr * expr
    | NotEquals         of expr * expr
    | GreaterOrEquals   of expr * expr
    | LessOrEquals      of expr * expr
    | Greater           of expr * expr
    | Less              of expr * expr
    | Not               of expr
    | And               of expr * expr
    | Or                of expr * expr
    | Xor               of expr * expr

type stmt = 
    | Drive     of  expr * expr * expr
    | Base
    | Open
    | Close
    | Type      of expr
    | IfThen    of expr * stmt 
    | IfThenElse of expr * stmt * stmt
    | While     of expr * stmt 
    | Assign    of string * expr
    | Seq       of (stmt list)

type prog = Prog of string * (stmt list)